//
//  CircleCell.m
//  BeautyClother
//
//  Created by dllo on 15/8/22.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "CircleCell.h"

@interface CircleCell ()

@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation CircleCell



- (void)dealloc
{
    [_icon release];
    [_label release];
    [_image release];
    [_name release];
    [_title release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        self.my = [[UIView alloc]init];
        self.image = [[UIImageView alloc]init];
        [self.my addSubview:self.image];
        [self.image release];
        self.title = [[UILabel alloc]init];
        [self.my addSubview:self.title];
        [self.title release];
        
        self.name = [[UILabel alloc]init];
        [self.my addSubview:self.name];
        [self.name release];
        self.date = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.date];
        [self.date release];
        self.icon = [[UIImageView alloc]init];
        [self.my addSubview:self.icon];
        [self.icon release];
        self.label = [[UIImageView alloc]init];
        [self.my addSubview:self.label];
        [self.label release];
        self.comment = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.comment];
        [self.comment release];
        self.visit = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.my addSubview:self.visit];
        [self.visit release];
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.my.frame = CGRectMake(5 *_offWidth, 0, self.frame.size.width - 10 *_offWidth, self.frame.size.height);
    self.my.layer.cornerRadius = 8;
    self.my.layer.masksToBounds = YES;
//    self.my.backgroundColor = [UIColor colorWithRed:187 / 255 green:255 / 255 blue:255 /255 alpha:0.1];
    [self.contentView addSubview:self.my];
    
    self.image.frame = CGRectMake(15 *_offWidth, 10 * _offHeight, 100 *_offWidth, 100 * _offHeight);
    _image.layer.cornerRadius = 5;
    _image.layer.masksToBounds = YES;
    self.icon.frame = CGRectMake(15 *_offWidth, 140 * _offHeight, 40 *_offWidth, 40 * _offHeight);
    self.icon.layer.cornerRadius = 40 *_offWidth / 2;
    self.icon.layer.masksToBounds = YES;
    self.label.frame = CGRectMake(120 *_offWidth, 10 * _offHeight, 20 *_offWidth, 20 * _offHeight);
    self.title.frame = CGRectMake(140 *_offWidth, 10 * _offHeight, 230 *_offWidth, 80 * _offHeight);
    self.title.numberOfLines = 0;
    self.name.frame = CGRectMake(70 *_offWidth, 140 * _offHeight, 100 *_offWidth, 20 * _offHeight);
    self.name.textColor = [UIColor colorWithRed:255/255 green:0 blue:255/255 alpha:0.8];
    
    UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(20 *_offWidth, 130 * _offHeight, self.contentView.frame.size.width - 40 *_offWidth, 0.2)];
    line.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:line];
    
    self.date.frame = CGRectMake(70 *_offWidth, 160 * _offHeight, 60 *_offWidth, 20 * _offHeight);
    _date.titleLabel.font = [UIFont systemFontOfSize:10];
    _date.titleLabel.textAlignment = 0;
    [_date setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [_date setImage:[UIImage imageNamed:@"date.png"] forState:UIControlStateNormal];
    [_date setTintColor:[UIColor darkGrayColor]];
    self.visit.frame = CGRectMake(260 *_offWidth, 150 * _offHeight, 60 *_offWidth, 20 * _offHeight);
    _visit.titleLabel.font = [UIFont systemFontOfSize:10];
    [_visit setImage:[UIImage imageNamed:@"v.png"] forState:UIControlStateNormal];
    [_visit setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [_visit setTintColor:[UIColor darkGrayColor]];
    [self.visit setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.comment.frame = CGRectMake(320 *_offWidth, 150 * _offHeight, 50 *_offWidth, 20 * _offHeight);
    _comment.titleLabel.font = [UIFont systemFontOfSize:10];
    [_comment setImage:[UIImage imageNamed:@"comm.png"] forState:UIControlStateNormal];
    [_comment setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [_comment setTintColor:[UIColor darkGrayColor]];
    [self.comment setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
